#ifndef CHARACTER_HH
#define CHARACTER_HH
/*
This header file defines the Character class, representing playable characters in a game. Inheriting from the ICharacter interface, it implements core character mechanics:
1.Core attributes (health, attack, defense)
2.Combat system (attacks, damage handling, status effects)
3.Inventory and accessory management
4.Stress and mental breakdown mechanics
5.Temporary defenses and combat buffs/debuffs
6.Gold and interaction systems
*/
/*
* 该头文件定义游戏中的可玩角色类Character，继承自ICharacter接口，
* 主要实现以下核心角色机制：
* 1. 核心属性（生命值、攻击力、防御力）
* 2. 战斗系统（攻击动作、伤害计算、状态效果）
* 3. 装备与饰品管理系统
* 4. 压力值与精神崩溃机制
* 5. 临时防御及战斗增益/减益效果
* 6. 金币与交互系统
*/
#include "ICharacter.hh"
#include "Item.hh"
#include <iostream>
#include <vector>
#include <string>

namespace DungeonRPG{

class Character : public ICharacter {
protected:
    std::string name;
    std::string description;
    unsigned health, maxHealth;
    unsigned attack;
    unsigned defense;
    unsigned stress = 0;
    unsigned maxStress = 100;
    bool virtue = false;
    bool afflicted = false;
    unsigned gold = 0;
    bool stunned = false;
    bool marked = false;
    int temporaryDefense = 0;
    std::vector<Item*> inventory;
    std::vector<Item*> accessories;

public:
    Character(std::string name, std::string desc, unsigned hp, unsigned atk, unsigned def);
    virtual ~Character();
    void heal(unsigned amount);  
    void resetBattleBuffs();
    bool isAlive() const override;
    bool takeDamage(unsigned damage) override;
    bool performAttack(ICharacter& target) override;

    std::string getName() const override;
    std::string getDescription() const override;
    unsigned getHealth() const override;
    unsigned getAttack() const override;
    unsigned getDefense() const override;
    std::string toString() const override;

    void addToInventory(Item* item) override;
    void displayInventory() const override;
    void display() const override;

    void increaseStress(unsigned amount);
    void relieveStress(unsigned amount);
    void checkMentalBreak();

    void gainGold(unsigned amount);
    unsigned getGold() const;

    void equipAccessory(Item* item);
    void unequipAccessory(int index);
    void showAccessories() const;

    void applyTemporaryDefense(int amount);
    void resetTemporaryDefense();
    int getTemporaryDefense() const;

    void setStunned(bool s);
    bool isStunned() const;

    void setMarked(bool m);
    bool isMarked() const;

    virtual bool canBeStunned() const {return false; }
};

}

#endif
